package org.jeecg.modules.xl.logicmana.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.xl.h5api.vo.H5LogiVo;
import org.jeecg.modules.xl.h5api.vo.LogiOrderDetail;
import org.jeecg.modules.xl.logicmana.entity.XlCustomerLogisticPackage;
import org.jeecg.modules.xl.logicmana.vo.LogisticOrderVO;
import org.jeecg.modules.xl.logicmana.vo.XlCustomerLogisticDetailVO;
import org.jeecg.modules.xl.logicmana.vo.XlCustomerLogisticPackageQuery;

import java.util.List;

/**
 * @Description: xl_customer_logistic_package
 * @Author: jeecg-boot
 * @Date:   2024-11-11
 * @Version: V1.0
 */
public interface XlCustomerLogisticPackageMapper extends BaseMapper<XlCustomerLogisticPackage> {

    @Select("" +
            "SELECT t1.upc_code,t2.product_name,t1.num " +
            "from xl_customer_logistic_package t1 " +
            "join xl_product_info t2 on t1.upc_code = t2.upc_code " +
            " where #{query.orderCode} = t1.order_code and #{query.logiOrder} = t1.logi_order " +
            " and #{query.logiCom} = t1.logi_com " +
            "")
    List<XlCustomerLogisticDetailVO> queryDetail(@Param("query") XlCustomerLogisticPackageQuery query);


    @Select("select t1.logi_order,t1.logi_com,t1.order_code,t1.upc_code," +
            "t2.product_name,t1.num,t1.create_time,t3.store_code,t3.store_name from xl_customer_logistic_package t1" +
            " join xl_product_info t2" +
            " on t1.upc_code = t2.upc_code" +
            " join xl_customer_orde t3" +
            " on t1.order_code = t3.order_code" +
            " where t1.logi_order = #{logi_order}   ")
    List<LogiOrderDetail> queryilogiDetail(@Param("logi_order") String logi_order);

    /**
     * 自定义查询订单
     * @param wrapper
     * @return
     */
    Page<LogisticOrderVO> list2(@Param("page") Page<LogisticOrderVO> page, @Param(Constants.WRAPPER) Wrapper<LogisticOrderVO> wrapper);

    List<H5LogiVo> getLogiListH5(@Param("order_code") String order_code);
}
